<template>
  <div>
    <MyTable :records='records' @my-search='search1'></MyTable>
  
  </div>
</template>

<script>

import MyTable from "@/components/MyTable.vue"



export default {
  components:{
    MyTable,

  },
  data() {
    return {
       records: [
        {
          date: "2022-01-01",
          doctor: "张三",
          diagnosis: "感冒",
          prescription: "感冒药",
        },
        {
          date: "2022-02-01",
          doctor: "李四",
          diagnosis: "头疼",
          prescription: "止疼药",
        },
        {
          date: "2022-03-01",
          doctor: "王五",
          diagnosis: "腰痛",
          prescription: "止痛贴",
        },
      ],
    }
  },
  methods: {
     search1(name) {
      this.records = this.records.filter((item) => 
        item.doctor === name
      );
    },
  }
}
</script>

<style scoped></style>
